added Feb 2001 SDK
[windows-sources.git] / shared source / sscli20 / jscript / engine / debug.cs
blob701a81dec288ecbc41a697b10e523e6b10999509
1 // ==++==
2 //
3 //
4 // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
5 //
6 // The use and distribution terms for this software are contained in the file
7 // named license.txt, which can be found in the root of this distribution.
8 // By using this software in any fashion, you are agreeing to be bound by the
9 // terms of this license.
10 //
11 // You must not remove this notice, or any other, from this software.
12 //
13 //
14 // ==--==
16 namespace Microsoft.JScript{
18 using System;
19 using System.Diagnostics;
21 static internal class Debug{
23 [Conditional("ASSERTION")]
24 public static void Assert(bool condition){
25 if (!condition)
26 throw new AssertException("Assertion fired");
29 [Conditional("ASSERTION")]
30 public static void Assert(bool condition, String message){
31 if (!condition)
32 throw new AssertException(message);
35 [Conditional("ASSERTION")]
36 public static void NotImplemented(String message){
37 throw new AssertException("Method Not Yet Implemented");
40 [Conditional("ASSERTION")]
41 public static void PostCondition(bool condition){
42 if (!condition)
43 throw new PostConditionException("PostCondition missed");
46 [Conditional("ASSERTION")]
47 public static void PostCondition(bool condition, String message){
48 if (!condition)
49 throw new PostConditionException(message);
52 [Conditional("ASSERTION")]
53 public static void PreCondition(bool condition){
54 if (!condition)
55 throw new PreConditionException("PreCondition missed");
58 [Conditional("ASSERTION")]
59 public static void PreCondition(bool condition, String message){
60 if (!condition)
61 throw new PreConditionException(message);
64 [Conditional("LOGGING")]
65 public static void Print(String str){
66 ScriptStream.Out.WriteLine(str);
69 [Conditional("LOGGING")]
70 internal static void PrintLine(String message) {
71 ScriptStream.Out.WriteLine(message);
74 [Conditional("LOGGING")]
75 public static void PrintStack(){
76 ScriptStream.PrintStackTrace();
79 [Conditional("LOGGING")]
80 public static void PrintStack(Exception e){
81 ScriptStream.PrintStackTrace(e);
86 internal class AssertException : Exception{
87 internal AssertException(String message)
88 : base(message) {
92 internal class PreConditionException : AssertException{
93 internal PreConditionException(String message)
94 : base(message) {
98 internal class PostConditionException : AssertException{
99 internal PostConditionException(String message)
100 : base(message) {